package com.hackordie.operations.updates;

import com.hackordie.commons.HackOrDieResult;
import com.hackordie.commons.hardware.components.AComponent;
import com.hackordie.exceptions.HackOrDieException;
import com.hackordie.operations.AHackOrDieOperationComponents;

public class UpdateComponent extends AHackOrDieOperationComponents{

	private AComponent component;
	private int        idComponent;
	
	public UpdateComponent(int idComponent, AComponent component) {
		super();
		this.idComponent = idComponent;
		this.component = component;
	}

	@Override
	protected boolean checkParameters() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	protected HackOrDieResult executeOperation() throws HackOrDieException {
		result.setCorrect(componentDao.update(idComponent, component));
		result.setObject(component);  //TODO quisas no aga falta este, los de los demas execute de components
		return result;
	}

}
